/*
 * @Descripttion:
 * @Author: voanit
 * @Date: 2022-03-22 16:43:06
 * @LastEditors: voanit
 * @LastEditTime: 2022-03-22 18:42:26
 */
import React, { useEffect } from 'react'
import avatar from './logo192.png'
import { newsActive } from '../../store/actions/newsList'
import { useDispatch, useSelector } from 'react-redux'
export default function NewsList() {
  const dispatch = useDispatch()
  const id = useSelector((state) => {
    return state.channel.id
  })
  const news = useSelector((state) => {
    return state.news
  })
  console.log(news, 89888)
  useEffect(() => {
    dispatch(newsActive(id))
  }, [id])
  return (
    <div className="list">
      ==={id}
      {news.map((item) => {
        return (
          <div className="article_item">
            <h3 className="van-ellipsis">{item.title}</h3>
            <div className="img_box">
              <img src={avatar} className="w100" alt="" />
            </div>
            <div className="info_box">
              <span>{}</span>
              <span>{item.comm_count}评论</span>
              <span>{item.pubdate}</span>
            </div>
          </div>
        )
      })}
    </div>
  )
}
